package com.guigu.liuyunan.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.liuyunan.pojo.Clinicdepartment;
import com.guigu.liuyunan.pojo.Diseaselibrary;
import com.guigu.liuyunan.pojo.LYNPageVo;
import com.guigu.liuyunan.service.DiseaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("LYN")
public class DiseaseController {

    @Autowired
    DiseaseService ds;


    @PostMapping("diseaseInfo")
    public PageInfo<Diseaselibrary> mealsInfo(@RequestBody LYNPageVo pageVo){
        if (pageVo.getName()!=null){
            pageVo.setName(pageVo.getName().trim());
        }
        return ds.DiseaseInfo(pageVo);
    }

    @PostMapping("clinicdepartmentInfo")
    public List<Clinicdepartment> mealsInfo(){
        return ds.ClinicdepartmentInfo();
    }

    @GetMapping("delDisease")
    public int delDisease(Integer id){
        return ds.delDisease(id);
    }

    @PostMapping("AddDisease")
    public int AddDisease(@RequestBody Diseaselibrary diseaselibrary){
        return ds.AddDisease(diseaselibrary);
    }

    @PostMapping("UpDisease")
    public int UpDisease(@RequestBody Diseaselibrary diseaselibrary){
        return ds.UpDisease(diseaselibrary);
    }



}
